package com.example.base.net

import com.example.base.entity.AddCartEntity
import com.example.base.entity.CartEntity
import com.example.base.entity.CategoryEntity
import com.example.base.entity.DetailEntity
import com.example.base.entity.ProductEntity
import com.example.base.entity.Res
import okhttp3.RequestBody
import retrofit2.http.Body
import retrofit2.http.GET
import retrofit2.http.POST
import retrofit2.http.Path
import retrofit2.http.Query

interface ApiService {
    @GET(Cons.CART_URL)
    suspend fun cart(@Query("isValid")isValid:String,@Query("limit")limit:String,@Query("page")page:String):Res<CartEntity>
    @POST(Cons.CART_UPDATE_URL)
    suspend fun cartUpdate(@Query("id")id:Int,@Query("number")number:Int):Res<String?>
    @POST(Cons.CART_DELETE_URL)
    suspend fun cartDelete(@Query("ids")ids:MutableList<Int>):Res<String?>
    @GET(Cons.CATEGORY_URL)
    suspend fun category():Res<CategoryEntity>
    @GET(Cons.PRODUCT_URL)
    suspend fun product(@Query("cid")cid:Int,@Query("limit")limit:Int,@Query("page")page:Int):Res<ProductEntity>
    @GET(Cons.DETAIL_URL)
    suspend fun detail(@Path("id")id:Int,@Query("type")type:String):Res<DetailEntity>
    @POST(Cons.CART_ADD_URL)
    suspend fun cartAdd(@Body body:RequestBody):Res<AddCartEntity>
}